//
//  CLHTTPRequest.h
//  CarLife
//
//  Created by yu on 2017/7/31.
//  Copyright © 2017年 jpas. All rights reserved.
//

#import <Foundation/Foundation.h>

/**
 请求成功的block

 @param response 响应体数据
 */
typedef void(^RequestSuccess)(id response);

/**
 请求失败的block
 
 @param error 扩展信息
 */
typedef void(^RequestFailure)(NSError *error);

/**
 上传进度的block

 @param progress 上传进度
 */
typedef void (^HttpProgress)(CGFloat progress);


@interface HTTPRequest : NSObject

+ (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field;
//+ (void)setResponseSerializer:(PPResponseSerializer)responseSerializer;

#pragma mark - 请求公共的方法 -

+ (NSURLSessionTask *)postRequestWithURL:(NSString *)URL
                              parameters:(id)parameter
                                    show:(BOOL)show
                                 success:(RequestSuccess)success
                                 failure:(RequestFailure)failure;

+ (NSURLSessionTask *)getRequestWithURL:(NSString *)URL
                             parameters:(id)parameter
                                   show:(BOOL)show
                                success:(RequestSuccess)success
                                failure:(RequestFailure)failure;

/**上传多张图片 */
+ (NSURLSessionTask *)uploadImagesWithURL:(NSString *)URL
                                   parameters:(id)parameters
                                         name:(NSString *)name
                                       images:(NSArray<UIImage *> *)images
                                   imageScale:(CGFloat)imageScale
                                    imageType:(NSString *)imageType
                                     progress:(HttpProgress)progresses
                                      success:(RequestSuccess)success
                                      failure:(RequestFailure)failure;
/**上传单张图片 */
+ (NSURLSessionTask *)uploadImageWithURL:(NSString *)URL
                               parameters:(id)parameters
                                     name:(NSString *)name
                                   images:(NSArray<UIImage *> *)images
                               imageScale:(CGFloat)imageScale
                                imageType:(NSString *)imageType
                                 progress:(HttpProgress)progresses
                                  success:(RequestSuccess)success
                                  failure:(RequestFailure)failure;

+ (void)uploadImageWithURL666:(NSString *)URL eqId:(NSString *)eqId types:(NSArray<NSString *> *)types parameters:(id)parameters name:(NSString *)name images:(NSArray<UIImage *> *)images imageScale:(CGFloat)imageScale imageType:(NSString *)imageType success:(void (^)(int status))success failure:(RequestFailure)failure;

@end
